﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using A2DFramework.EventService.SuperSocket.Core;
using A2DFramework.QueueService;
using A2DFramework.InstanceService;

namespace A2DFramework.EventService
{
    public class EventResolver : IEventResolver
    {
        private IQueue queueSrv=ObjectFactory.Resolve<IQueue>();

        /// <summary>
        /// 解析传入的消息，解析后发到消息队列中
        /// </summary>
        /// <param name="msg"></param>
        public void Resolve(string msg)
        {
            string evtClassPath;
            string evtXml;
            if (Helper.IsEventBusCommand_Publish(msg, out evtClassPath, out evtXml))
            {
                //send to queue
                EventInfo info = new EventInfo();
                info.ClassType = evtClassPath;
                info.Xml = evtXml;
                queueSrv.SendRequest2Worker<EventInfo>(info);
            }
        }
    }
}
